//
//  DM_OrmSQLiteDB.swift
//  构建者模式_ORM_SWIFT
//
//  Created by 王苏进 on 17/5/17.
//  Copyright © 2017年 macOS. All rights reserved.
//

import UIKit

class DM_OrmSQLiteDB: DM_SQLiteDB {
    
    let createBuilder = DM_OrmSQLCreateTableBuidler()
    
    //创建表 更新字段  删除表 查询表等等
    
    func createTable(cls: Swift.AnyClass) -> Int {
        
        if let orm_ = getOrm(cls) {
         let sql = createBuilder.createTable(orm: orm_).builder()
         
          return Int(execute(sql: sql))
        }
       
        return 0
        
    }
    
    
    func getOrm(_ cls: Swift.AnyClass) -> DM_Orm? {
        let className =  NSStringFromClass(cls)
        
        
        return DM_TemplateConfig.sharedInstace.ormDic[className]
    }

}
